package com.example.split.service.impl;

import com.example.split.conf.SplitProperties;
import com.example.split.service.ISplitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class ISplitServiceImpl implements ISplitService {

    @Autowired
    private SplitProperties splitProperties;

    @Override
    public List<String> split(String value) {
        List list = Stream.of(StringUtils.split(value, ",")).collect(Collectors.toList());
        list.add(splitProperties.getName());
        list.add(splitProperties.getAge());
        return list;
    }
}

